{% extends "base.html" %}
{% load staticfiles %}
{% block title %}公开课课程机构列表 - 自学资源{% endblock %}
{% block custom_bread %}
    <section>
        <div class="wp">
            <ul  class="crumbs">
                <li><a href="{% url 'index' %}">首页</a>></li>
                <li>公开课</li>
            </ul>
        </div>
    </section>
{% endblock  %}
{% block content %}
<section>
	<div class="wp">
		<div class="list" style="margin-top:0;">
			<div class="left layout">
				<div class="head">
					<ul class="tab_header">
						<li class="{% if sort == '' %}active{% endif %}"><a href="?sortmanage=">最新 </a></li>
						<li  class="{% if sort == 'hot' %}active{% endif %}" ><a href="?sort=hot">最热门</a></li>
						<li class="{% if sort == 'students' %}active{% endif %}" ><a href="?sort=students">参与人数</a></li>
					</ul>
				</div>
                <div id="inWindow">
                    <div class="tab_cont " id="content">
					<div class="group_list">
                    {% for row in all_course.object_list %}
                            <div class="box">
                                <a href="{% url 'course:course_detail' row.id %}">
                                    <img width="280" height="350" class="scrollLoading" src="{{ MEDIA_URL }}{{ row.image }}"/>
                                </a>
                                <div class="des">
                                    <a href="{% url 'course:course_detail' row.id %}">
                                        <h2>{{row.name}}</h2>
                                    </a>
                                    <span class="fl">时长：<i class="key">{{row.learn_times}}</i></span>
                                    <span class="fr">学习人数：{{row.students}}&nbsp;&nbsp;</span>
                                </div>
                                <div class="bottom">
                                    <a href="{% url 'course:course_detail' row.id %}"><span class="fl">来自{{row.course_org.name}}</span></a>
                                    <span class="star fr  notlogin
                                        " data-favid="15">
                                        {{row.fav_nums}}
                                    </span>
                                </div>
                            </div>
                    {% endfor %}

					</div>
                    <div class="pageturn">
                        <ul class="pagelist">
                        {% if all_course.has_previous %}
                            <li class="long"><a href="??{{ all_course.previous_page_number.querystring }}">上一页</a></li>
                        {% endif %}
                            {% for page in all_course.pages %}
                                {% if page %}
                                    {% ifequal page all_course.number %}
                                    <li class="active"><a href="?{{ page.querystring }}">{{ page }}</a></li>
                                    {% else %}
                                    <li><a href="?{{ page.querystring }}" class="page">{{ page }}</a></li>
                                    {% endifequal %}
                                {% else %}
                                    <li class="none"><a href="">...</a></li>
                                {% endif %}
                            {% endfor %}
                        {% if all_course.has_next %}
                            <li class="long"><a href="?{{ all_course.next_page_number.querystring }}">下一页</a></li>
                        {% endif %}

                        </ul>
                    </div>
				</div>
                </div>
			</div>
			<div class="right layout">
				<div class="head">热门课程推荐</div>
				<div class="group_recommend">
                {% for row in hot_course %}
                    <dl>
						<dt>
							<a target="_blank" href="{% url 'course:course_detail' row.id %}">
								<img width="240" height="220" class="scrollLoading" src="{{ MEDIA_URL }}{{ row.image }}"/>
							</a>
						</dt>
						<dd>
							<a target="_blank" href="{% url 'course:course_detail' row.id %}"><h2> {{row.name}}</h2></a>
                            <span class="fl">难度：<i class="key">{{row.get_degree_display}}</i></span>
                            <!--在django中，如果渲染的字段里用的是choices属性，那么如果直接调用就会显示choices中的key值，要想显示value，那就要用model内置的get_'字段名'_display方法-->
						</dd>
					</dl>
                 {% endfor %}   


				</div>
			</div>
		</div>
	</div>
</section>

{% endblock %}

